Skip to content

refactor: update event types from FormEvent to ChangeEvent in various components#40823

Merged
ggazzo merged 1 commit into
developfrom
refactor/prepare-types-for-react-19-21
Jun 9, 2026
Merged

refactor: update event types from FormEvent to ChangeEvent in various components#40823
ggazzo merged 1 commit into
developfrom
refactor/prepare-types-for-react-19-21

Conversation

@tassoevan

@tassoevan tassoevan commented Jun 4, 2026

Copy link
Copy Markdown
Member

⚠️ This is part 21/23 of #40796. PR for refactor/prepare-types-for-react-19-20 must be merged first.


Proposed changes (including videos or screenshots)

As a first step towards upgrading to React 19, it handles types from @types/react looking forward the next major.

Issue(s)

Task: ARCH-2170

Steps to test or reproduce

Further comments

No runtime change is expected from it.

Summary by CodeRabbit

  • Refactor
    • Aligned input and form event typings with React change-event semantics across the app for more accurate type checking and safer event handling.
    • Tightened component reference and ref typings to improve type safety and developer tooling.
    • Updated several prop and callback type signatures to match UI input wiring without altering runtime behavior.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6a61c6ce-27e8-4a1b-9ad9-d993c40b4a4a

📥 Commits

Reviewing files that changed from the base of the PR and between 187ee16 and cf6dc5d.

📒 Files selected for processing (33)
  • apps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/EditStatusModal.tsx
  • apps/meteor/client/sidebar/header/MatrixFederationSearch/MatrixFederationManageServerModal.tsx
  • apps/meteor/client/sidebar/header/MatrixFederationSearch/MatrixFederationSearchModalContent.tsx
  • apps/meteor/client/views/account/security/TwoFactorEmail.tsx
  • apps/meteor/client/views/account/security/TwoFactorTOTP.tsx
  • apps/meteor/client/views/admin/customSounds/AddCustomSound.tsx
  • apps/meteor/client/views/admin/customSounds/EditSound.tsx
  • apps/meteor/client/views/admin/import/NewImportPage.tsx
  • apps/meteor/client/views/admin/permissions/PermissionsTable/PermissionsTableFilter.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/BooleanSettingInput.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/FontSettingInput.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/GenericSettingInput.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/IntSettingInput.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/PasswordSettingInput.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/RelativeUrlSettingInput.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/StringSettingInput.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/TimespanSettingInput.tsx
  • apps/meteor/client/views/admin/settings/SettingsGroupPage/SettingsGroupPage.tsx
  • apps/meteor/client/views/admin/settings/groups/LDAPGroupPage.tsx
  • apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx
  • apps/meteor/client/views/audit/components/forms/DateRangePicker.tsx
  • apps/meteor/client/views/mediaCallHistory/CallHistoryPageFilters.tsx
  • apps/meteor/client/views/omnichannel/analytics/DateRangePicker.tsx
  • apps/meteor/client/views/omnichannel/cannedResponses/contextualBar/CannedResponse/CannedResponseList.tsx
  • apps/meteor/client/views/omnichannel/departments/DepartmentTags.tsx
  • apps/meteor/client/views/omnichannel/directory/contacts/RemoveContactModal.tsx
  • apps/meteor/client/views/room/Header/Omnichannel/QuickActions/QuickActionOptions.tsx
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembers.tsx
  • apps/meteor/client/views/room/contextualBar/Threads/ThreadList.tsx
  • packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustomList.tsx
  • packages/ui-voip/src/providers/useMediaSession.ts
  • packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryActions.stories.tsx
✅ Files skipped from review due to trivial changes (11)
  • apps/meteor/client/views/admin/settings/SettingsGroupPage/SettingsGroupPage.tsx
  • apps/meteor/client/views/room/contextualBar/Threads/ThreadList.tsx
  • apps/meteor/client/views/omnichannel/analytics/DateRangePicker.tsx
  • apps/meteor/client/views/account/security/TwoFactorEmail.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/GenericSettingInput.tsx
  • packages/ui-voip/src/providers/useMediaSession.ts
  • packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryActions.stories.tsx
  • apps/meteor/client/sidebar/header/MatrixFederationSearch/MatrixFederationSearchModalContent.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/RelativeUrlSettingInput.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/PasswordSettingInput.tsx
  • apps/meteor/client/views/mediaCallHistory/CallHistoryPageFilters.tsx
🚧 Files skipped from review as they are similar to previous changes (20)
  • apps/meteor/client/views/omnichannel/directory/contacts/RemoveContactModal.tsx
  • apps/meteor/client/views/account/security/TwoFactorTOTP.tsx
  • apps/meteor/client/sidebar/header/MatrixFederationSearch/MatrixFederationManageServerModal.tsx
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/client/views/admin/settings/groups/LDAPGroupPage.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/StringSettingInput.tsx
  • apps/meteor/client/views/admin/customSounds/AddCustomSound.tsx
  • apps/meteor/client/views/omnichannel/cannedResponses/contextualBar/CannedResponse/CannedResponseList.tsx
  • apps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembers.tsx
  • apps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/EditStatusModal.tsx
  • packages/ui-client/src/components/MultiSelectCustom/MultiSelectCustomList.tsx
  • apps/meteor/client/views/room/Header/Omnichannel/QuickActions/QuickActionOptions.tsx
  • apps/meteor/client/views/admin/import/NewImportPage.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/TimespanSettingInput.tsx
  • apps/meteor/client/views/admin/permissions/PermissionsTable/PermissionsTableFilter.tsx
  • apps/meteor/client/views/audit/components/forms/DateRangePicker.tsx
  • apps/meteor/client/views/omnichannel/departments/DepartmentTags.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/IntSettingInput.tsx
  • apps/meteor/client/views/admin/customSounds/EditSound.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/BooleanSettingInput.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/FontSettingInput.tsx
🧠 Learnings (2)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/FontSettingInput.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx
  • apps/meteor/client/views/admin/settings/Setting/inputs/FontSettingInput.tsx
🔇 Additional comments (2)
apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx (1)

6-6: LGTM!

Also applies to: 24-24, 69-69

apps/meteor/client/views/admin/settings/Setting/inputs/FontSettingInput.tsx (1)

2-2: LGTM!

Also applies to: 25-25


Walkthrough

This PR standardizes React event type annotations across the codebase, replacing incorrect FormEvent/SyntheticEvent types with ChangeEvent for input handlers, and ensuring form submissions use FormEvent or inferred typing. It also includes small type-safety fixes (refs, useReducer, Storybook typing).

Changes

React Event Type Standardization

Layer / File(s) Summary
Input change handler corrections
apps/meteor/client/navbar/..., apps/meteor/client/sidebar/..., apps/meteor/client/views/account/security/*, apps/meteor/client/views/admin/customSounds/*, apps/meteor/client/views/admin/import/*, apps/meteor/client/views/admin/permissions/*, apps/meteor/client/views/audit/components/forms/*, apps/meteor/client/views/mediaCallHistory/*, apps/meteor/client/views/omnichannel/analytics/*, apps/meteor/client/views/omnichannel/cannedResponses/*, apps/meteor/client/views/omnichannel/departments/*, apps/meteor/client/views/room/contextualBar/Threads/*, packages/ui-client/src/components/MultiSelectCustom/*
Input onChange handlers across modals, dialogs, and search inputs are updated from FormEvent/SyntheticEvent types to ChangeEvent<HTMLInputElement> typing, preserving runtime behavior of reading currentTarget.value.
Settings input component event handlers
apps/meteor/client/views/admin/settings/Setting/inputs/*
Admin settings input components (Boolean, Font, Generic, Int, Password, RelativeUrl, String, Timespan) are standardized to use ChangeEventHandler<HTMLInputElement> for their handleChange callbacks, replacing inconsistent prior types.
Component prop type alignment
apps/meteor/client/views/omnichannel/cannedResponses/contextualBar/CannedResponse/CannedResponseList.tsx, apps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembers.tsx, packages/ui-client/src/components/MultiSelectCustom/*
Component props like setText and onSelected are updated from FormEventHandler/FormEvent to ChangeEventHandler/ChangeEvent to align with TextInput and input onChange semantics.
Form submit handler corrections
apps/meteor/client/views/admin/settings/groups/LDAPGroupPage.tsx, apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx, apps/meteor/client/views/mediaCallHistory/CallHistoryPageFilters.tsx, apps/meteor/client/views/omnichannel/directory/contacts/RemoveContactModal.tsx, apps/meteor/client/navbar/...
Form onSubmit handlers are corrected to use proper FormEvent<HTMLFormElement> typing or rely on inference while preserving preventDefault() calls.
Explicit ref type annotations
apps/meteor/client/views/room/Header/Omnichannel/QuickActions/QuickActionOptions.tsx, apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
Refs are given explicit TypeScript type parameters (useRef<HTMLButtonElement>, useRef<HTMLTextAreaElement>) instead of remaining untyped.
Storybook and utility type updates
apps/meteor/client/views/admin/settings/SettingsGroupPage/SettingsGroupPage.tsx, packages/ui-voip/src/providers/useMediaSession.ts, packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryActions.stories.tsx
Storybook decorator typing switches from StoryFn to Decorator, React type imports are normalized to include ReactNode, and an explicit useReducer generic typing is removed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • ggazzo
  • dougfabris
  • juliajforesti
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating event types from FormEvent to ChangeEvent across multiple components for React 19 compatibility.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (2)
  • REACT-19: Request failed with status code 401
  • ARCH-2170: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cf6dc5d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dionisio-bot

dionisio-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.11%. Comparing base (d485f13) to head (cf6dc5d).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40823      +/-   ##
===========================================
+ Coverage    70.10%   70.11%   +0.01%     
===========================================
  Files         3341     3341              
  Lines       123661   123661              
  Branches     22144    22136       -8     
===========================================
+ Hits         86691    86710      +19     
+ Misses       33607    33600       -7     
+ Partials      3363     3351      -12     
Flag Coverage Δ
e2e 59.33% <70.58%> (+0.09%) ⬆️
e2e-api 46.30% <ø> (+0.03%) ⬆️
unit 70.93% <80.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tassoevan tassoevan force-pushed the refactor/prepare-types-for-react-19-21 branch from 2e8e785 to c7e7f93 Compare June 9, 2026 16:47
@tassoevan tassoevan added this to the 8.6.0 milestone Jun 9, 2026
@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Jun 9, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jun 9, 2026
@tassoevan tassoevan force-pushed the refactor/prepare-types-for-react-19-21 branch 2 times, most recently from c32dbc0 to 187ee16 Compare June 9, 2026 20:46
@tassoevan tassoevan marked this pull request as ready for review June 9, 2026 20:47
@tassoevan tassoevan requested a review from a team as a code owner June 9, 2026 20:47

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 33 files

Re-trigger cubic

… components

- Changed event types from FormEvent to ChangeEvent in MatrixFederationManageServerModal, MatrixFederationSearchModalContent, TwoFactorEmail, TwoFactorTOTP, AddCustomSound, EditSound, NewImportPage, PermissionsTableFilter, BooleanSettingInput, FontSettingInput, GenericSettingInput, IntSettingInput, PasswordSettingInput, RelativeUrlSettingInput, StringSettingInput, TimespanSettingInput, SettingsGroupPage, LDAPGroupPage, UsersTableFilters, DateRangePicker, CallHistoryPageFilters, Omnichannel analytics DateRangePicker, CannedResponseList, DepartmentTags, RemoveContactModal, QuickActionOptions, MessageBox, RoomMembers, ThreadList, MultiSelectCustomList, and useMediaSession.
@tassoevan tassoevan force-pushed the refactor/prepare-types-for-react-19-21 branch from 187ee16 to cf6dc5d Compare June 9, 2026 22:12
@ggazzo ggazzo merged commit 50b7933 into develop Jun 9, 2026
44 checks passed
@ggazzo ggazzo deleted the refactor/prepare-types-for-react-19-21 branch June 9, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants